/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.meteocal.entity;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 *
 * @author paolo
 */
@Entity
public class InvitedList implements Serializable {

    private static final long serialVersionUID = 1L;

    /*ATTRIBUTE*/
    @EmbeddedId
    protected InvitedListPK invitedListMP;

    private Boolean partecipation;

    /*RELATIONSHIP*/
    //INVITEDLIST-EVENT
    @JoinColumn(name = "event", referencedColumnName = "eventID", insertable = false, updatable = false)
    @ManyToOne
    private Event event;

    //INVITEDLIST-USER
    @JoinColumn(name = "user", referencedColumnName = "email", insertable = false, updatable = false)
    @ManyToOne
    private User user;

    public InvitedListPK getInvitedListPK() {
        return invitedListMP;
    }

    public void setInvitedListPK(InvitedListPK invitedListPK) {
        this.invitedListMP = invitedListPK;
    }

    public Boolean getPartecipation() {
        return partecipation;
    }

    public String getPartecipationString() {
        if(partecipation == null){
            return "MAYBE";
        }
        if (partecipation) {
            return "YES";
        }
        if (!partecipation) {
            return "NO";
        }
        return "errore";
    }

    public void setPartecipation(Boolean partecipation) {
        this.partecipation = partecipation;
    }

    public Event getEvent() {
        return event;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}
